﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JTicket.Model;
using System.Web.Security;
using JTicket.BLL;
namespace JTicket.UI
{
    public partial class JT_BoardManager : RoleBase
    {
        public List<JTicket.Model.D_Boardinfo> _boardInfo { get; set; }
        private readonly BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                Bind();
        }
        void Bind()
        {
            Model.D_OperInfo oper= bllOper.Oper();
            string CurLevel = oper.CurLevel.ToString();//系统级权限
            string ThCode = oper.ThCode;//企业编号
            string kw=string.Empty;//搜索关键字
            int page = 0;
            int pages = 0;
            int len=30;
            if (!string.IsNullOrEmpty(Request.QueryString["page"]))
            {
                page = int.Parse(Request.QueryString["page"]);
                kw = Request.QueryString["KeyWord"].ToString();
            }
            //判断权限获取数据。
            switch (CurLevel)
            {
                case "0"://系统权限
                    _boardInfo = BLL.D_Boardinfo.GetList(page, len, ref pages);
                    break;
                case "1"://售票员
                    _boardInfo = BLL.D_Boardinfo.GetListByThCode(page, len, ref pages, ThCode, kw);
                    break;
                case "2"://验票员
                    break;
                case "3"://剧院管理员
                    _boardInfo = BLL.D_Boardinfo.GetListByThCode(page, len, ref pages, ThCode,kw);
                    break;
                case "4"://财务员
                    break;
                case "5"://经理
                    break;
                case "6"://客服
                    break;
                case "7"://企业管理员
                    break;
                default:
                    _boardInfo = new List<Model.D_Boardinfo>(0);
                    break;
            }
            ScriptManager.RegisterStartupScript(
               this, typeof(Page), "pages", string.Format("var page={0};var pages={1};", page, pages), true);
        }
 
    }
}